package mapping

import (
	"maya-service/model"
	"maya-service/model/entity"
)

// ProductsEntityToDto entity data transfer
func ProductsEntityToDto(products []*entity.Product) []*model.ProductInfo {
	out := make([]*model.ProductInfo, 0, len(products))
	for _, c := range products {
		out = append(out, ProductEntityToDto(c))
	}
	return out
}

// ProductEntityToDto entity data transfer
func ProductEntityToDto(e *entity.Product) *model.ProductInfo {
	return &model.ProductInfo{

		Id: e.Id,

		Name: e.Name,

		CategoryId: e.CategoryId,

		ProductType: e.ProductType,

		Description: e.Description,

		Price: e.Price,

		Stock: e.Stock,

		Status: e.Status,

		ImageURL: e.ImageURL,

		ExtraContext: e.ExtraContext,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
